home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 4 / ETO Development Tools 4.iso / Essentials / MacApp Documentation / MacApp.TECH$ Archives / 1989 / Dec 89 / 0137-Pascal 3.1(re More o-Nov89 < prev    next >
Encoding:
Text File  |  1991-03-06  |  1.8 KB  |  67 lines  |  [TEXT/GEOL]

  1. Item forwarded  by  A33          to A34
  2.  
  3. Item    7819184                         30-Nov-89        07:31
  4.  
  5. From:   DEREK                           White, Derek
  6.  
  7. To:     MACAPP.TECH$                    MacApp Technical
  8.  
  9. Sub:    Pascal 3.1(re More on Uses)
  10.  
  11. James, Tseung, and fellow MacAppers,
  12.  
  13.   Your statements about mutual dependencies in objects are correct for MPW
  14. Pascal 3.0.  There are some major problems with that scheme however.
  15. Mis-spelled types are assumed to be forward object types for instance:
  16.     TObj = OBJECT
  17.         fEmpty:     bboolean;    {<= assumed to be a forward object }
  18.     END;
  19.  
  20. For MPW 3.1 and beyond, the prefered way of implementing forward object
  21. references in the more explicit:
  22.  
  23. UNIT UTest;
  24. TYPE
  25.     TSecond = OBJECT;   FORWARD;
  26.  
  27.     TFirst = OBJECT
  28.         fSecond:        TSecond;
  29.     END;  { TFirst }
  30.  
  31.     TSecond = OBJECT
  32.         fFirst:         TFirst;
  33.     END;  { TSecond }
  34. END.
  35.  
  36.   Eventually the current, implicit forward object references will be
  37. disallowed (the -forward option turns off implicit forward objects in 3.1).
  38.   You will also be able to seperate object declarations into different units
  39. using the EXTERNAL modifier:
  40.  
  41. UNIT UFirst;
  42. USES USecond;
  43. TYPE
  44.     TSecond = OBJECT; EXTERNAL; {must declare external because USecond
  45.                                  uses me}
  46.     TFirst = OBJECT
  47.         fSecond: TSecond;
  48.     END;
  49. END.
  50.  
  51. UNIT USecond;
  52. USES UFirst;
  53. TYPE
  54.     TFirst = OBJECT; EXTERNAL; {must declare external because UFirst
  55.                                 uses me}
  56.     TSecond = OBJECT
  57.         fFirst: TFirst;
  58.     END;
  59. END.
  60.  
  61. By declaring the mutually referenced classes EXTERNAL in BOTH units, the order
  62. of using and compiling the units doesn't matter so much.  This should bring a
  63. little more sense to the wacky world of mutual dependancies.  Call APDA for
  64. availibility of MPW 3.1.
  65.  - Derek White
  66.  
  67.